<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>视频测试</title>
  <link
    href="./node_modules/video.js/dist/video-js.min.css"
    rel="stylesheet"
  />
  <style>
    .play-videoes, video, .video-js {
      width: 100%;
      height: 300px;
    }
  </style>
</head>
<body>
  <h1>原生播放</h1>
  <div webkit-playsinline="true" x5-playsinline="true" playsinline="true" class="play-videoes">
    <video webkit-playsinline="true" x5-playsinline="true" playsinline="true" controls="controls">
      <source
        src="http://videocdn.didano.com/school863class0channelId3623namegeogle/playlist.m3u8"
        type="application/x-mpegURL"
      >
    </video>
  </div>
  <h1>播放器播放</h1>
  <div webkit-playsinline="true" x5-playsinline="true" playsinline="true" class="play-videoes">
    <video id="videoPlay" webkit-playsinline="true" x5-playsinline="true" playsinline="true" controls="controls" class="video-play video-js">
      <source
        src="http://videocdn.didano.com/school863class0channelId3623namegeogle/playlist.m3u8"
        type="application/x-mpegURL"
      >
    </video>
  </div>

  <script src="./node_modules/video.js/dist/video.min.js"></script>
  <script src="./node_modules/videojs-contrib-hls/dist/videojs-contrib-hls.min.js"></script>

  <script>
    alert(sessionStorage.getItem('pagehide'))

    window.addEventListener('beforeunload', function (event) {
      event.preventDefault();
      event.returnValue = '我在这写点东西...';
    });

    window.addEventListener('pagehide', async (event) => {
      sessionStorage.setItem('pagehide', 'pagehide')
    });

    videojs('videoPlay', {
      bigPlayButton: true,
      textTrackDisplay: false,
      posterImage: true,
      errorDisplay: true,
      requestFullscreen: false
    });
  </script>
</body>
</html>